package com.truthbean.jeetb.utils.web;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletRequestWrapper;

import static com.truthbean.jeetb.utils.web.invoker.Invoker.PAGE_CHARSET;
import static com.truthbean.jeetb.utils.web.invoker.Invoker.REQUEST_CHARSET;

public class MyRequest extends HttpServletRequestWrapper {
    public MyRequest(HttpServletRequest req) {
        super(req);
    }

    public String getParameter(String name) {
        try {
            String value = super.getParameter(name);
            if (name == null)
                return null;
            return new String(value.getBytes(REQUEST_CHARSET), PAGE_CHARSET);
        } catch (Exception e) {
            return null;
        }
    }
}